#include "VisitorDisplayName.h"
#include "..\..\ui_mainwindow.h"
#include "..\..\mainwindow.h"

VisitorDisplayName::VisitorDisplayName(QString strName, QString strWidgetName)
{
    m_strName = strName;
    m_strWidgetName = strWidgetName;
}

void VisitorDisplayName::VisitorElement(IUIElement* pElement)
{
    if (nullptr == pElement)
    {
        return;
    }
    
    MainWindow *pMain = dynamic_cast<MainWindow *>(pElement); 
    if (NULL != pMain)
    {
        QLabel *pLabel = pMain->findChild<QLabel *>(m_strWidgetName);
        if (pLabel)
        {
            pLabel->setText(m_strName);
        }
    }
}
